<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
	xmlns:a="http://richfaces.org/a4j"
    template="/layout/template.xhtml">

<ui:define name="body">

	<rich:panel>
		<f:facet name="header">Make a new Request!!</f:facet>   
		<h:panelGrid >
			<s:button view="/acab/request/CreateRequest1.xhtml" value="new Request" propagation="join"/>
		</h:panelGrid>
	</rich:panel>

	<rich:panel>
		<f:facet name="header">These are my requests</f:facet>   
		<h:panelGrid >
		
			<h:outputText value="The user search returned no results."
               rendered="#{empty myRequestsBean.resultList}"/>

		    <rich:dataTable id="myRequestsBean"
		                var="_request"
		              value="#{myRequestsBean.resultList}"
		           rendered="#{not empty myRequestsBean.resultList}">

		        <h:column>
		            <f:facet name="header">
		                <ui:include src="/layout/sort.xhtml">
		                    <ui:param name="entityList" value="#{myRequestsBean}"/>
		                    <ui:param name="propertyLabel" value="Request name"/>
		                    <ui:param name="propertyPath" value="request.name"/>
		                </ui:include>
		            </f:facet>
		            <h:outputText value="#{_request.name}"/>
		        </h:column>
		        
		        <h:column>
		            <f:facet name="header">From</f:facet>
		            #{'('}
		            <h:outputText value="#{_request.fromLat}"/>
		            #{'-'}
		            <h:outputText value="#{_request.fromLon}"/>
		            #{')'}
		        </h:column>

		        <h:column>
		            <f:facet name="header">To</f:facet>
		            #{'('}
		            <h:outputText value="#{_request.toLat}"/>
		            #{' - '}
		            <h:outputText value="#{_request.toLon}"/>
		            #{')'}
		        </h:column>
		        
		        <h:column>
		            <f:facet name="header">Date/Period</f:facet>
					<h:outputText>
						#{_request.beginDate}
						#{_request.singleDay? '' :  ' / '}
						#{_request.singleDay? '' :  _request.endDate}
					</h:outputText>
		        </h:column>
		        
		        
		        <h:column>
		            <f:facet name="header">Suggestions</f:facet>
					<h:outputText rendered="#{not empty _request.suggestions}">
						Has suggestions
					</h:outputText>
		        </h:column>


		        
		        
		        <rich:column styleClass="action">
		            <f:facet name="header">Action</f:facet>
		            <s:link view="/acab/request/ViewRequest.xhtml"
		                   value="View"
		             propagation="none"
		                      id="requestViewId"
		                      action="#{requestBean.loadRequestAction}">
		                <f:param name="idRequest"
		                        value="#{_request.idRequest}"/>
		            </s:link>
		            #{' '}
		            <s:link view="/UserEdit.xhtml"
		                   value="Edit"
		             propagation="none"
		                      id="requestEdirId">
		                <f:param name="idRequest"
		                        value="#{_request.idRequest}"/>
		            </s:link>
		        </rich:column>
		        
		    </rich:dataTable>
		
		
		  
		</h:panelGrid>
	</rich:panel>		
        
        
</ui:define>
</ui:composition>
